package com.yonyou.pmclouds.discuss.rmiimpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.discuss.entity.DiscussNoticeVO;
import com.yonyou.pmclouds.discuss.entity.DiscussionVO;
import com.yonyou.pmclouds.discuss.itf.DiscussInternalOperation;
import com.yonyou.pmclouds.discuss.itf.DiscussNoticeInternalOperation;
import com.yonyou.pmclouds.discuss.rmiitf.DiscussQuery;
import org.springframework.beans.factory.annotation.Autowired;

@Service(version = ApplicationConsts.APPLICATION_VERSION, interfaceClass = DiscussQuery.class)
public class DiscussQueryImpl implements DiscussQuery {
    @Autowired
    private DiscussInternalOperation discussOperation;
    @Autowired
    private DiscussNoticeInternalOperation noticeOperation;

    @Override
    public DiscussionVO[] queryDiscussByRelateKey(String relateKey, String tenantId) {
        return discussOperation.queryByRelateId(relateKey, tenantId);
    }

    @Override
    public DiscussNoticeVO[] queryNoticeByReceiver(String receiver, int pageStart, int pageSize) {
        return noticeOperation.queryByReceiver(receiver, pageStart, pageSize);
    }

    @Override
    public boolean hasUnreadNotice(String user) throws BusinessException {
        return noticeOperation.hasUnreadNotice(user);
    }

    @Override
    public int countUnreadNotice(String user) throws BusinessException {
        return noticeOperation.countUnreadNotice(user);
    }

}
